home *** CD-ROM | disk | FTP | other *** search
- //
- // File: AboutAnimation.c
- // Project: main68K.π
- // Author: Glenn L. Austin
- // Symantec Corporation
- //
- #include "IsNative.h"
- #include <GestaltEqu.h>
- #include <Traps.h>
- #include <SetUpA4.h>
-
- MyGlobals *glob;
- Str255 sysSoftStr;
-
- ResType GetCodeRsrcType(void) = {0x202C, 0x0004}; // Move.L 4(A4),D0
- short GetCodeRsrcID(void) = {0x302C, 0x0008}; // Move.W 8(A4),D0
-
- extern pascal void ShowInit(short id, short move);
-
- pascal void main(void)
- {
- MyProcInfo pi;
- MyProcInfo* mpi;
- long result;
-
- RememberA0();
- SetUpA4();
- DetachResource(Get1Resource(GetCodeRsrcType(), GetCodeRsrcID()));
-
- mpi = π
- mpi->pMyGlobals = &glob;
- mpi->pGet1Rsrc = StripAddress((Ptr) MyGet1Resource);
- mpi->pDrawString = StripAddress((Ptr) MyDrawString);
- mpi->pDrawMenuBar = StripAddress((Ptr) MyDrawMenuBar);
- mpi->pExitToShell = StripAddress((Ptr) MyExitToShell);
-
- if (!Gestalt(gestaltNativeCPUtype, &result) && (result & 0x100))
- {
- short vRefNum;
- long dirID;
- short rFile;
- SysEnvRec env;
-
- SysEnvirons(curSysEnvVers, &env);
- HGetVol(nil, &vRefNum, &dirID);
- SetVol(nil, env.sysVRefNum);
-
- if ((rFile = OpenResFile(LMGetFinderName())) != -1)
- {
- GetIndString(sysSoftStr, 10000, 3); // read the string from the Finder
- CloseResFile(rFile);
- }
-
- HSetVol(nil, vRefNum, dirID);
- }
-
- {
- THz cZone = GetZone();
-
- SetZone(SystemZone());
-
- glob = (MyGlobals*) NewPtrClear(sizeof(MyGlobals));
- glob->appInfo = (MyAppInfoHand) NewHandle(0);
- glob->oldG1RTrap = (void*) GetToolTrapAddress(_Get1Resource);
- glob->oldDrwStrTrap = (void*) GetToolTrapAddress(_DrawString);
- glob->oldDrwMBarTrap = (void*) GetToolTrapAddress(_DrawMenuBar);
- glob->oldE2STrap = (void*) GetToolTrapAddress(_ExitToShell);
-
- SetToolTrapAddress((void*) mpi->pGet1Rsrc, _Get1Resource);
- SetToolTrapAddress((void*) mpi->pDrawString, _DrawString);
- SetToolTrapAddress((void*) mpi->pDrawMenuBar, _DrawMenuBar);
- SetToolTrapAddress((void*) mpi->pExitToShell, _ExitToShell);
-
- SetZone(cZone);
- }
-
- ShowInit(128, -1);
-
- RestoreA4();
- }
-
- long SetA4World(void)
- {
- asm {
- Move.L A1,-(SP)
- }
- SetUpA4();
- asm {
- Move.L (SP)+,D0
- Move.L (SP)+,A1
- }
- }
-
- void RestoreA4World(long oldA4)
- {
- asm {
- Move.L oldA4,A4
- }
- }
-